var o = require("../UIManager/UISoundManager.js");
cc.Class({
    extends: cc.Component,
    properties: {},
    onLoad: function () {
        this.btnParentNode = Global.utils.searchNode(this.node, "node");
    },
    start: function () {
    },
    onClickWan: function () {
        o.playEffect("select"), this.sendReq(Global.config.tileColor.TILE_COLOR_WAN);
    },
    onClickTong: function () {
        o.playEffect("select"), this.sendReq(Global.config.tileColor.TILE_COLOR_TONG);
    },
    onClickTiao: function () {
        o.playEffect("select"), this.sendReq(Global.config.tileColor.TILE_COLOR_TIAO);
    },
    sendReq: function (e) {
        var t = Global.tableModel.getRoomId(), n = Global.tableModel.getTableId(),
            o = Global.tableModel.getSeatId();
        0 != t && 0 != n ? (Global.msgHandler.requestAbsence(t, n, o, e), this.node.removeFromParent(),
        this.node.isValid && this.node.destroy()) : cc.error("NodeAbsenceController sendReq", "roomId = " + t + " tableId = " + n + " seatId = " + o);
    },
    doAnimByIndex: function (e) {
        e >= 0 && this.btnParentNode.children[e].getComponent(cc.Animaion).play();
    },
    playAni: function (e) {
        if (e >= 0) {
            var t = Global.utils.searchNode(this.node, "node").children[e].getComponent(cc.Animation);
            t.on("finished", function () {
                t.scheduleOnce(function () {
                    t.play();
                }, 1);
            }, this), t.play();
        }
    }
})
